// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 

package com.yztag;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.SimpleTagSupport;

import com.eportal.domain.Sysopt;

public class YzActButton extends SimpleTagSupport {
    protected String onclick;
    protected String ioc;
    protected String title;
    protected String power;
    protected String event;

    public YzActButton() {
    }


    public void doTag()
            throws JspException, IOException {
        StringBuffer sb = new StringBuffer();
        HttpServletRequest request = (HttpServletRequest) ((PageContext) getJspContext()).getRequest();
        String basepath = request.getContextPath();
        Object sessionValue = (Object) request.getSession().getAttribute("admin");
        String uname = "";
        if (sessionValue instanceof Sysopt) {
            uname = ((Sysopt) sessionValue).getUserName();
        } 
//        else if (sessionValue instanceof Tagent) {
//            uname = ((Tagent) sessionValue).getAgtloguser();
//        }

//权限暂时不判断 2015-6-18
        sb.append("{onclick:\"" + onclick + "\",ioc:\"<img src='" + basepath + "/images/admin/ioc" + ioc + "' border='0'>\",title:'" + title + "'");
        if (event != null && !event.equals("")) {
            sb.append(",event:" + event);
        }
        sb.append("},");
//权限暂时不判断 2015-6-18 --- 老代码

//     		if(uname.equals("admin")){
//     			sb.append("{onclick:\""+onclick+"\",ioc:\"<img src='"+basepath+"/images/admin/ioc"+ioc+"' border='0'>\",title:'"+title+"'");
// 				if(event!=null&&!event.equals("")){
// 					sb.append(",event:"+event);
// 				}
// 				sb.append("},");
//     		}else{
//	     		String menuid=sysuser.getSysrole().getMenuid();
//	     		String[] menuids=menuid.split("\\|");
//	     		for(String m:menuids){
//	     			if(power==null||power.equals(m)){
//	     				sb.append("{onclick:\""+onclick+"\",ioc:\"<img src='"+basepath+"/images/admin/ioc"+ioc+"' border='0'>\",title:'"+title+"'");
//	     				if(event!=null&&!event.equals("")){
//	     					sb.append(",event:"+event);
//	     				}
//	     				sb.append("},");
//	     				break;
//	     			}
//	     		}
//     		}
        getJspContext().getOut().println(sb);
    }


    public void setPower(String power) {
        this.power = power;
    }


    public void setOnclick(String onclick) {
        this.onclick = onclick;
    }


    public void setIoc(String ioc) {
        this.ioc = ioc;
    }


    public void setTitle(String title) {
        this.title = title;
    }


    public void setEvent(String event) {
        this.event = event;
    }


}
